/**
 * 
 */
package unit;

import static org.junit.Assert.*;
import implementation.Node;

import operands.Operand;
import operators.Operator;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author NextEpisode1
 *
 */
public class NodeTest {
	private Node testNode;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		testNode=new Operator("+");
		testNode.setRight(new Operand("1"));
		testNode.setLeft(new Operand("2"));
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		testNode=null;
	}

	/**
	 * Test method for {@link implementation.Node#getContent()}.
	 */
	@Test
	public void testGetContent() {
		assertEquals("+", testNode.getContent());
	}

	/**
	 * Test method for {@link implementation.Node#setContent(java.lang.String)}.
	 */
	@Test
	public void testSetContent() {
		testNode.setContent("-");
		assertEquals("-", testNode.getContent());
	}

	/**
	 * Test method for {@link implementation.Node#getLeft()}.
	 */
	@Test
	public void testGetLeft() {
		assertNotNull(testNode.getLeft());
	}

	/**
	 * Test method for {@link implementation.Node#setLeft(implementation.Node)}.
	 */
	@Test
	public void testSetLeft() {
		Operand o = new Operand("a");
		testNode.setLeft(o);
		assertSame(testNode.getLeft(), o);    
	}

	/**
	 * Test method for {@link implementation.Node#getRight()}.
	 */
	@Test
	public void testGetRight() {
		assertNotNull(testNode.getRight());
	}

	/**
	 * Test method for {@link implementation.Node#setRight(implementation.Node)}.
	 */
	@Test
	public void testSetRight() {
		Operand o = new Operand("a");
		testNode.setRight(o);
		assertSame(testNode.getRight(), o);    
	}
}
